package com.wcl.demo.db;

import com.wcl.demo.model.entity.NoteBgData;
import com.wcl.demo.model.entity.NoteBgDataDao;

import java.util.List;

/**
 * Created by dllo on 15/12/2.
 */
public class NoteBgHelper {
    private DaoSingleton instance = DaoSingleton.getInstance();
    private NoteBgDataDao noteBgDataDao;
    public NoteBgHelper() {
        this.noteBgDataDao = instance.getNoteBgDataDao();
    }
    /**
     * 保存
     * @param backGroundDatas
     */
    public void saveBgInfor(List<NoteBgData> noteBgDatas){
        noteBgDataDao.insertInTx(noteBgDatas);
    }

    /***
     * 删除数据
     */
    public void deleteBg() {
        noteBgDataDao.deleteAll();
    }

    public List<NoteBgData> queryAll(){
        return noteBgDataDao.loadAll();
    }
    /**
     * 按自增长id查询
     */
    public List<NoteBgData> queryById(long id){
        List<NoteBgData> list=noteBgDataDao.queryBuilder().where(NoteBgDataDao.Properties.Note_bg_message.eq(id)).list();
        return list;
    }
}
